package com.zpark;

import java.util.Scanner;

/**
 * 鸡兔同笼
 * 书P7-9
 * 复杂度O（n）
 */
public class demo01 {
    public static void main(String[] args) {
        //定义一个scanner扫描器，接受用户的输入
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你要测试的组数");
        int nCases = scan.nextInt();
        for (int i = 0; i < nCases; i++){
            System.out.println("请输入动物的脚的数量：");
            int feets = scan.nextInt();
            if (feets < 0 || feets >= 32768){
                System.out.println("您输入的数据有误！");
                System.exit(0);
            }
            else if (feets % 4 == 0)
                System.out.printf("%d %d\n", feets/4, feets/2);
            else if (feets % 2 == 0)
                System.out.printf("%d %d\n", feets/4+1, feets/2);
            else
                System.out.println("0,0");
        }
    }
}
